﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Linq;

namespace UtilZ.Dotnet.Ex.ValueDescription
{
    /// <summary>
    /// 扩展描述基类
    /// </summary>
    public abstract class ExtendDescriptionAbs : IExtendDescription
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public ExtendDescriptionAbs()
        {

        }


        /// <summary>
        /// 尝试获取扩展值对应的名称[获取成功返回true,获取失败返回false]
        /// </summary>
        /// <param name="value">值</param>
        /// <param name="group">描述组</param>
        /// <param name="name">值对应的名称</param>
        /// <returns>获取成功返回true,获取失败返回false</returns>
        public bool TryGetName(object value, IValueDescriptionGroup group, out string name)
        {
            return this.PrimitiveTryGetName(value, group, out name);
        }

        /// <summary>
        /// 尝试获取扩展值对应的名称[获取成功返回true,获取失败返回false]
        /// </summary>
        /// <param name="value">值</param>
        /// <param name="group">描述组</param>
        /// <param name="name">值对应的名称</param>
        /// <returns>获取成功返回true,获取失败返回false</returns>
        protected virtual bool PrimitiveTryGetName(object value, IValueDescriptionGroup group, out string name)
        {
            throw new NotImplementedException();
        }








        /// <summary>
        /// 尝试获取扩展值对应的描述[获取成功返回true,获取失败返回false]
        /// </summary>
        /// <param name="value">值</param>
        /// <param name="group">描述组</param>
        /// <param name="des">值对应的描述</param>
        /// <returns>获取成功返回true,获取失败返回false</returns>
        public bool TryGetDescription(object value, IValueDescriptionGroup group, out string des)
        {
            return this.PrimitiveTryGetDescription(value, group, out des);
        }

        /// <summary>
        /// 尝试获取扩展值对应的描述[获取成功返回true,获取失败返回false]
        /// </summary>
        /// <param name="value">值</param>
        /// <param name="group">描述组</param>
        /// <param name="des">值对应的描述</param>
        /// <returns>获取成功返回true,获取失败返回false</returns>
        protected virtual bool PrimitiveTryGetDescription(object value, IValueDescriptionGroup group, out string des)
        {
            throw new NotImplementedException();
        }








        /// <summary>
        /// 根据名称获取值(获取成功返回true;失败返回false)
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="group">描述组</param>
        /// <param name="value">值</param>
        /// <returns>获取成功返回true;失败返回false</returns>
        public bool TryGetValueByName(string name, IValueDescriptionGroup group, out object value)
        {
            return this.PrimitiveTryGetValueByName(name, group, out value);
        }

        /// <summary>
        /// 根据名称获取值(获取成功返回true;失败返回false)
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="group">描述组</param>
        /// <param name="value">值</param>
        /// <returns>获取成功返回true;失败返回false</returns>
        protected virtual bool PrimitiveTryGetValueByName(string name, IValueDescriptionGroup group, out object value)
        {
            throw new NotImplementedException();
        }








        /// <summary>
        /// 根据值描述获取值(获取成功返回true;失败返回false)
        /// </summary>
        /// <param name="des">值描述</param>
        /// <param name="group">描述组</param>
        /// <param name="value">值</param>
        /// <returns>获取成功返回true;失败返回false</returns>
        public bool TryGetValueByDescription(string des, IValueDescriptionGroup group, out object value)
        {
            return this.PrimitiveTryGetValueByDescription(des, group, out value);
        }


        /// <summary>
        /// 根据值描述获取值(获取成功返回true;失败返回false)
        /// </summary>
        /// <param name="des">值描述</param>
        /// <param name="group">描述组</param>
        /// <param name="value">值</param>
        /// <returns>获取成功返回true;失败返回false</returns>
        protected virtual bool PrimitiveTryGetValueByDescription(string des, IValueDescriptionGroup group, out object value)
        {
            throw new NotImplementedException();
        }

    }
}
